class CreateComments < ActiveRecord::Migration
  def self.up
    create_table :comments do |t|
      t.column :user_id, :integer
      t.column :image_id, :integer
      t.column :text, :longtext
      t.column :rating, :integer, :default => 0
      t.column :root_id, :integer, :default => 0, :references => nil
      t.column :parent_id, :integer, :default => 0, :references => nil
      t.column :lft, :integer, :default => 0
      t.column :rgt, :integer, :default => 0
      t.column :depth, :integer, :default => 0
      t.column :deleted_reason,            :text
      t.column :deleted_by,                :integer, :references => :users
      t.column :deleted_at,                :datetime
      t.column :purged_at,                 :datetime
      t.column :created_at, :datetime
      t.column :updated_at, :datetime      
    end
  end

  def self.down
    drop_table :comments
  end
end
